<template>
    <div class="Home">
        <div class="contanier">
            <div class="swiper-menu">
                <swiper ref="mySwiper" :options="swiperOptions">
                    <swiper-slide v-for="item in swiperList" :key="item.id">
                        <a href="javascript:;">
                          <img :src="item.img" alt="" />
                        </a>
                    </swiper-slide>
                    <div class="swiper-pagination" slot="pagination"></div>
                </swiper>
            </div>
            <div class="ads-list">
              <div class="ads-item" v-for="item in adsList" :key="item.id">
                <p class="ads-title1">{{item.title}}</p>
                <p class="ads-title2">{{item.remark}}</p>
                <div class="ads-img">
                  <img :src="item.img" alt="">
                </div>
              </div>
            </div>
            <div class="hot-product"></div>
        </div>
    </div>
</template>

<script>
import { Swiper, SwiperSlide} from 'vue-awesome-swiper';
import 'swiper/css/swiper.css';
export default {
    name: 'Home',
    data() {
        return {
            swiperOptions: {
                pagination: {
                    el: '.swiper-pagination',
                    clickable: true
                },
                effect: 'cube',
                cubeEffect: {
                    shadowOffset: 100,
                    shadowScale: 0.4
                },
                autoplay: true,
                loop: true,
            },
            swiperList: [
                {
                    id: 1,
                    img: '/img/1.jpg',
                },
                {
                    id: 2,
                    img: '/img/壁纸.jpg'
                }
            ],
            adsList: [
              {
                id: 1,
                title: '坚果新品，惊喜上市',
                remark: '配件新品，现已全面上架',
                img: '/img/phone1.png'
              },
              {
                id: 2,
                title: '以旧换新',
                remark: '旧机换新机，坚果新体验',
                img: '/img/phone2.png'
              },
              {
                id: 3,
                title: '地平线8号箱包系列',
                remark: '为了野心与远方',
                img: '/img/lvxingxiang1.png'
              },
              {
                id: 4,
                title: '坚果新品，惊喜上市',
                remark: '配件新品，现已全面上架',
                img: '/img/phone4.png'
              }
            ]
        }
    },
    components: {
        Swiper,
        SwiperSlide
    },
    computed: {
      swiper() {
        return this.$refs.mySwiper.$swiper
      }
    },
}
</script>

<style lang="less">
.Home {
    background-color: rgb(237,237,237);
    .contanier {
      border-top: 1px solid #ccc;
        .swiper-menu {
            margin-top: 20px;
            height: 400px;
            border-bottom: 1px solid pink;
            .swiper-container {
                height: 400px;
                img {
                    height: 400px;
                    width: 100%;
                }
            }
        }
        .ads-list {
            display: flex;
            height: 200px;
            margin-top: 20px;
            .ads-item {
              width: 25%;
              background-color: #fff;
              transition: all .2s;
              padding: 20px;
              text-align: center;
              cursor: pointer;
              transition: all .3s;
              &:hover {
                transform: translateY(-5px);
                box-shadow: 4px 6px 7px rgba(0,0,0,.2);
              }
              .ads-title1 {
                font-size: 16px;
                font-weight: 700;
              }
              .ads-title2 {
                font-size: 14px;
                margin-top: 10px;
                margin-bottom: 5px;
                color: #ccc;
              }
              .ads-img {
                img {
                  height: 120px;
                  width: auto;
                }
              }
            }
        }
        .hot-product {
            height: 400px;
        }
    }
}
</style>
